package cq.com.cn.service;

import cq.com.cn.dao.GoodsCardDao;
import cq.com.cn.model.BooksModel;
import cq.com.cn.model.GoodsCardModel;

import java.util.List;

public class GoodsCardService {

    public void saveGoodsCard(int userId,String bookId){
        BooksService booksService=new BooksService();
        BooksModel bk = booksService.selectBookById(bookId);

        GoodsCardDao goodsCardDao=new GoodsCardDao();
        goodsCardDao.insertGoodsCard(userId,bookId,bk.getBookUrl(),bk.getBookName(),bk.getPrice(),bk.getStock());
    }
    public List<GoodsCardModel> queryGoodsCardByUserId(int userId){
        GoodsCardDao goodsCardDao=new GoodsCardDao();
        return goodsCardDao.findGoodsCardByUserId(userId);
    }

}
